package com.springBoot.springBootSysCore.modules.enums;

import com.springBoot.springBootSysCore.common.utils.enumUtils.EnumFindHelper;
import com.springBoot.springBootSysCore.common.utils.enumUtils.EnumKeyGetter;
import com.springBoot.springBootSysCore.common.utils.enumUtils.EnumKeyVal;

import java.util.List;

/**
 * 审核状态枚举
 * @author yh
 *
 */
public enum AuditStateEnum {
	/**
	 * 未审核:0
	 */
	NO_AUDIT("未审核","0"),
	/**
	 * 审核通过 :1
	 */
	YES_AUDIT("审核通过","1"),
	/**
	 * 审核不通过:2
	 */
	REFUSE("审核未通过","2");
	
	private String name;
	private String val;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getVal() {
		return val;
	}

	public void setVal(String val) {
		this.val = val;
	}

	private AuditStateEnum(String name, String val) {
		this.name = name;
		this.val = val;
	}
	static final EnumFindHelper<AuditStateEnum, String> keyHelperT =
			new EnumFindHelper<AuditStateEnum, String>(AuditStateEnum.class, new AuditStateEnum.KeyGetter());
	static final EnumFindHelper<AuditStateEnum, String> keyHelper =
			new EnumFindHelper<AuditStateEnum, String>(AuditStateEnum.class, new AuditStateEnum.KeyGetter(), new AuditStateEnum.ValGetter());

	static final EnumFindHelper<AuditStateEnum, String> valHelperT =
			new EnumFindHelper<AuditStateEnum, String>(AuditStateEnum.class,new AuditStateEnum.ValGetter());
	static final EnumFindHelper<AuditStateEnum, String> valHelper =
			new EnumFindHelper<AuditStateEnum, String>(AuditStateEnum.class,new AuditStateEnum.ValGetter(), new AuditStateEnum.KeyGetter());

	static class KeyGetter implements EnumKeyGetter<AuditStateEnum, String> {
		@Override
		public String getKey(AuditStateEnum enumValue) {
			return enumValue.name;
		}
	}
	static class ValGetter implements EnumKeyGetter<AuditStateEnum, String> {
		@Override
		public String getKey(AuditStateEnum enumValue) {
			return enumValue.val;
		}
	}
	/* static class OrderKeyGetter implements EnumKeyGetter<PaymentWay, Integer> {
         @Override
         public Integer getKey(PaymentWay enumValue) {
             return enumValue.order;
         }
     }*/
	public static AuditStateEnum valfindT(String name, AuditStateEnum defaultValue){
		return keyHelperT.findT(name, defaultValue);
	}
	public static AuditStateEnum nameFindT(String val, AuditStateEnum defaultValue){
		return valHelperT.findT(val, defaultValue);
	}
	public static Object valfind(String name, String defaultValue){
		return keyHelper.find(name, defaultValue);
	}
	public static Object nameFind(String val, String defaultValue){
		return valHelper.find(val, defaultValue);
	}
	public static List<EnumKeyVal> keyValList(){
		return keyHelper.keyValList();
	}
	
}
